﻿function getListItemByFilter(url, listname, filterName, filterValue) {
    $.ajax({
        url: url + "/_api/web/lists/getbytitle('" + listname + "')/items/?$filter=" + filterName + " eq '" + filterValue + "'",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            var itemsBloc = $('#home-left').children('.items-bloc');
            $(itemsBloc).children('ul').empty();
            for (var item in data.d.results) {
                var bloc = createBloc(data.d.results[item].Title
                    , data.d.results[item].Lien.Url
                    , data.d.results[item].Photo.Url
                    , data.d.results[item].Chapeau);
                $(itemsBloc).children('ul').append('<li>' + bloc + '</li>');
            }
        },
        error: function (data) {
        }
    });
}
